<!doctype html>
<html>
	<head>
		<meta charset="utf-8">
		<!-- Set render engine for 360 browser -->
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<!-- HTML5 shim for IE8 support of HTML5 elements -->
		<!--[if lt IE 9]>
			<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js">
			</script>
		<![endif]-->
		<link href="__THEMES__/css/theme.min.css" rel="stylesheet">
		<link href="__THEMES__/css/simplebootadmin.css" rel="stylesheet">
		<link href="__THEMES__/css/default.css" rel="stylesheet" />
		<link href="__THEMES__/css/font-awesome.min.css"
		rel="stylesheet" type="text/css">
		<style>
			.length_3{width: 180px;} form .input-order{margin-bottom: 0px;padding:3px;width:40px;}
			.table-actions{margin-top: 5px; margin-bottom: 5px;padding:0px;} .table-list{margin-bottom:
			0px;}
			label{display: inline-block; margin-right: 20px;}
		</style>
		<!--[if IE 7]>
			<link rel="stylesheet" href="__THEMES__/css/font-awesome-ie7.min.css">
		<![endif]-->
		<script type="text/javascript">
			//全局变量
			var GV = {
				WEB_ROOT:"",
				DIMAUB: "/",
				JS_ROOT: "/theme/backend/assets/js/",
				TOKEN: ""
			};
		</script>
		<!-- Le javascript==================================================-
		-> <!-- Placed at the end of the document so the pages load faster -->
		<script src="__THEMES__/js/jquery.js"></script>
		<script src="__THEMES__/js/wind.js"></script>
		<script src="__THEMES__/js/bootstrap.min.js"></script>
		<script type="text/javascript">
		$(function(){
			var privs="{$listUser[0]['privs']}";
			if(privs.length>0){
				privs=privs.split(",");
				for(var i=0;i<privs.length;i++){
					$(":checkbox[value='"+privs[i]+"']").prop("checked",true);
				}
			}
			$(".parentPriv").click(function(){
				if($(this).attr("checked")){
					$(this).parents("tr").find("table.listPriv").find(":checkbox").prop("checked",true);
				}else{
					$(this).parents("tr").find(":checkbox").prop("checked",false);
				}
			});
			$(".childPriv").click(function(){
				if($(this).attr("checked")){
					$(this).parents("td.childtd").siblings("td").find(":checkbox").prop("checked",true);
				}else{
					$(this).parents("td.childtd").siblings("td").find(":checkbox").prop("checked",false);
				}
			});
		});
		</script>
	</head>
	<body>
		<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
			<li><a href="{:url('Member/admin')}">管理员</a></li>
			<li><a href="{:url('Member/add')}">管理员添加</a></li>
			<li class="active"><a href="{:url('Member/priv')}">编辑权限</a></li>
		</ul>
		<form action="" method="post">
		<input type="hidden" name="id" value="{$listUser[0]['id']}" />
		<table cellspacing="1" cellpadding="4" width="100%" align="center" class="tableborder">
    	<tbody><tr class="header">
      		<td colspan="2">设置管理员 [{$listUser[0]['username']}] 的后台权限</td>
    		</tr>
    {volist name="listPrivs" id="vo"}
    <tr>
      <td bgcolor="#F4F8FC" width="145"><label for="{$vo.controller}_{$vo.action}_{$vo.id}">
          <input name="privs[]" type="checkbox" class="parentPriv" id="{$vo.controller}_{$vo.action}_{$vo.id}" value="{$vo.id}">
          {$vo.name}</label>
      </td>
      <td class="altbg2">
      	{notempty name="vo.son"}
      	<table cellspacing="1" cellpadding="4" width="100%" align="center" class="tableborder listPriv">
      	{volist name="$vo.son" id="child"}
      	<tr>
      		<td width="10%" class="childtd"><label for="{$child.controller}_{$child.action}_{$child.id}"><input type="checkbox" id="{$child.controller}_{$child.action}_{$child.id}" name="privs[]" class="childPriv" value="{$child.id}">{$child.name}</label> </td>
      		{notempty name="child.son"}
      		<td>
      		{volist name="$child.son" id="son"}
      		<label for="{$son.controller}_{$son.action}_{$son.id}"><input type="checkbox" id="{$son.controller}_{$son.action}_{$son.id}" name="privs[]" value="{$son.id}">{$son.name}</label> 
      		{/volist}
      		</td>
      		{/notempty}
      	</tr>
        {/volist}
        </table>
        {/notempty}
     </td>
    </tr>
    {/volist}
    
	</tbody>
	</table>
	<div class="form-actions">
		<button type="submit" class="btn btn-primary">确定操作</button>
		<a class="btn" href="javascript:history.go(-1)">返回</a>
	</div>
	</form>
		<div class="pagination"></div>
	</div>
		<script src="__THEMES__/js/common.js"></script>
	</body>

</html>